package com.moensun.akka.springboot.akka;

import akka.actor.ActorSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.moensun.akka.springboot.akka.SpringExtension.SpringExtProvider;

/**
 * Created by Bane.Shi.
 * Copyright MoenSun
 * User: Bane.Shi
 * Date: 2017/3/8
 * Time: 15:45
 */
@Configuration
public class AppConfiguration {
	@Autowired
	private ApplicationContext applicationContext;

	@Bean
	public ActorSystem actorSystem() {
		ActorSystem system = ActorSystem.create("akka-spring-boot");
		SpringExtProvider.get(system).initialize(applicationContext);
		return system;
	}
}
